package com.boot.common.utils;

import java.util.Collection;
import java.util.Map;

/**
 * @author Cheng JiYe
 * @description:
 * @date 2020/10/2 2:04
 */
public class CollectionUtils {

  /**
   * 判断集合为空
   *
   * @param collection 集合
   * @return boolean
   */
  public static boolean isEmpty(Collection<?> collection) {
    return (collection == null || collection.isEmpty());
  }

  /**
   * 判断集合不为空
   *
   * @param collection 集合
   * @return boolean
   */
  public static boolean isNotEmpty(Collection<?> collection) {
    return !isEmpty(collection);
  }

  /**
   * 判断 map为空
   *
   * @param map 键值对
   * @return boolean
   */
  public static boolean isEmpty(Map<?, ?> map) {
    return (map == null || map.isEmpty());
  }

  /**
   * 判断map不为空
   *
   * @param map 键值对
   * @return boolean
   */
  public static boolean isNotEmpty(Map<?, ?> map) {
    return !isEmpty(map);
  }
}
